package com.huan.loadbalancer.controller;

import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 提供者控制器
 *
 * @author huan.fu
 * @date 2023/3/6 - 21:58
 */
@RestController
public class ProviderController {

    @Resource
    private NacosDiscoveryProperties nacosDiscoveryProperties;

    /**
     * 获取服务信息
     *
     * @return ip:port
     */
    @GetMapping("serverInfo")
    public String serverInfo() {
        return nacosDiscoveryProperties.getIp() + ":" + nacosDiscoveryProperties.getPort();
    }
}
